<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/vant@1.6/lib/index.css">
		<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js"></script>
		<script src="https://cdn.jsdelivr.net/npm/vant@1.6/lib/vant.min.js"></script>
		<script type="text/javascript" src="../../js/fanhui.js" ></script>
		<script src="html5plus://ready"></script>
		<script>
			document.addEventListener('plusready', function() {
				//console.log("所有plus api都应该在此事件发生后调用，否则会出现plus is undefined。"
		
			});
			
		</script>
	</head>
	<style>
		.icon_center {
			float: none;
			display: inline-block;
			text-align: center;
		}

		img {
			border-radius: 200px;
			width: 70px;
			height: 70px;
			margin-top:50px;
		}
	</style>
	
	<body>
		<div id="app">
			<van-row>
				<van-row style="height: 120px; text-align: center;">
					<img :src="imgUrl">
					<span style="position: absolute;margin-top: 130px;margin-left: -60px; color: white;">{{userName}}</span>
					<p v-if="islogin" @click="toLogin" style="color: #000000;">未登录<p>
				</van-row>
				<br />
				<van-row>
					<van-col span="6">
						<div class="icon_center" @click="obligation">
							<van-icon size="30px" name="pending-payment"></van-icon>
							<p>待付款</p>
						</div>
					</van-col>
					<van-col span="6">
						<div class="icon_center" @click="dfh">
							<van-icon size="30px" name="records"></van-icon>
							<p>待发货</p>
						</div>
					</van-col>
					<van-col span="6">
						<div class="icon_center" @click="dpj">
							<van-icon size="30px" name="tosend"></van-icon>
							<p>待评论</p>
						</div>
					</van-col>
					<van-col span="6">
						<div class="icon_center" @click="mydingdan">
							<van-icon size="30px" name="logistics"></van-icon>
							<p>我的订单</p>
						</div>
					</van-col>

				</van-row>
			</van-row>
			<van-cell-group>
				<van-cell icon="records" @click="gr" title="个人资料" is-link />
				</van-cell>
				<br/>
				<van-cell icon="location-o" @click="dz" title="收获地址" is-link></van-cell>
				<br/>
				<van-cell icon="star-o" @click="shoucang" title="我的收藏" is-link></van-cell>
				<br/>
				<a href="mailto://17634336179@163.com">
				<van-cell icon="envelop-o"  title="投诉|建议" is-link></van-cell>
				</a>
				<br/>
				<van-cell icon="setting-o" @click="sz" title="设置" is-link></van-cell>
			</van-cell-group>
		</div>
	</body>
	<script>
			document.addEventListener('plus ready', function() {
				//console.log("所有plus api都应该在此事件发生后调用，否则会出现plus is undefined。"
		
			});
		var vm = new Vue({
			el: '#app',
			data: {
				userName:"未登录",
				imgUrl: "../../img/3.jpg",
				islogin:true,
				user:[
					
				]
			},
			methods: {
				obligation:function(){//待付款
					if(this.user==null)
					{
						this.$toast('你还没登陆呢！');
					}else{
						plus.webview.show(plus.webview.create("dfk.html", "dfk"));
					}
				},
				dfh(){//待发货
					if(this.user==null)
					{
						this.$toast('你还没登陆呢！');
					}else{
						plus.webview.show(plus.webview.create("daifahuo.html", "login"));
					}
				},
				dpj(){//待评论
					if(this.user==null)
					{
						this.$toast('你还没登陆呢！');
					}else{
						plus.webview.show(plus.webview.create("daipingjia.html", "login"));
					}
				},
				mydingdan(){//我的订单
					if(this.user==null)
					{
						this.$toast('你还没登陆呢！');
					}else{
						plus.webview.show(plus.webview.create("Mydingdan.html", "login"));
					}
				},
				gr(){/*个人资料*/
					if(this.user==null)
					{
						this.$toast('你还没登陆呢！');
					}else{
						plus.webview.show(plus.webview.create("grzl.html", "login"));
					}
				},
				dz(){//收货地址
					if(this.user==null)
					{
						this.$toast('你还没登陆呢！');
					}else{
						plus.webview.show(plus.webview.create("tjdz.html", "login"));
					}
				},
				
				shoucang(){//我的收藏
					if(this.user==null)
					{
						this.$toast('你还没登陆呢！');
					}else{
						plus.webview.show(plus.webview.create("sc.html", "login"));
					}
				},
				sz(){//注册
					if(this.user==null)
					{
						this.$toast('你还没登陆呢！');
					}else{
						plus.webview.show(plus.webview.create("shezhi.html", "shezhi"));
					}
				},
				toLogin:function(){//登录
					plus.webview.show(plus.webview.create("Login.html", "login"));
				}
			},
			created:function(){
				var _this = this;
				 document.addEventListener("plusready", function(){
					 _this.user=plus.storage.getItem("user");
					  _this.user = JSON.parse( _this.user); //把字符串格式转换成Json格式
					 if(_this.user==null){
					 	_this.islogin=true;
					 }else{
					 	_this.islogin=false;
						_this.imgUrl=_this.user.UserData.AvatarImage;//用户头像
						_this.userName = _this.user.UserData.NickName; //用户名
					 }
					 _this.user=JSON.parse(_this.user);//string转json对象
					 console.log(_this.user);
				 })
			}
		});
	</script>
</html>
